using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DataAccessLayer;
using System.Collections.Generic;

public partial class UserRegistration : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Common c = new Common();
        string conn = c.fetchConnString();
        User urg = new User(conn);
        List<string> lstUserRegistration = new List<string>();
        DataTable dtUserRegistration = urg.LoadInterest();

        foreach (DataRow drRow in dtUserRegistration.Rows)
            lstUserRegistration.Add(drRow[0].ToString());

        ddlInterest.DataSource = lstUserRegistration;
        ddlInterest.DataBind();
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        Common c = new Common();
        string conn = c.fetchConnString();
        User rg = new User(conn);
        rg.NAME = txtName.Text.Trim(' ');
        rg.EMAIL = txtEmail.Text.Trim(' ');
        rg.PASSWORD = txtPassword.Text;
        rg.DOB = txtDob.Text;
        rg.GENDER = ddlGender.SelectedItem.Text;
        rg.INTEREST = ddlInterest.SelectedItem.Text.Trim(' ');
        rg.SECQ = txtSecQues.Text.Trim(' ');
        rg.SECA = txtSecAns.Text.Trim(' ');
        int temp = rg.funcVerification(txtEmail.Text);

        if (temp == 1)
            lblError.Visible = true;
        else
        {
            rg.funcRegistration();

            Response.Redirect("Home.aspx");
        }
    }
    protected void calDob_SelectionChanged(object sender, EventArgs e)
    {
        txtDob.Text = calDob.SelectedDate.ToShortDateString().ToString();
    }
    protected void lnkAboutUs_Click(object sender, EventArgs e)
    {
        Response.Redirect("About Us.aspx");
    }
    protected void lnkContactUs_Click(object sender, EventArgs e)
    {
        Response.Redirect("Contact Us.aspx");
    }
    protected void lnkFeedback_Click(object sender, EventArgs e)
    {
        Response.Redirect("Feedback.aspx");
    }
    protected void imgbtnHome_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("Home.aspx");
    }
}
